<?php

	include($_SERVER['DOCUMENT_ROOT']."/headerins.php");
	include($_SERVER['DOCUMENT_ROOT']."/headerFrame.php");


echo '
<div id="contextCaption">Создание позиции заказа.</div>
<div id="insert_response"></div>
<hr>
<!-- <form action="javascript:Request('."'".'OrderLine'."'".', '."'".'create'."'".', '	.$_GET['OrderID'].	')" method="POST">-->
<form>
    <table border="0" id="contextGrid" cellspacing="0" cellspacing="0" width="100%">
        <tr><th style="width: 40px;"><label for="MaterialID">#Продукта</label>
		
					<td><input list="Materials" name="Material" id="MaterialID" onchange="getMaterialDetail()" size="25px" style="width: 70%; float: left;">
					<datalist id="Materials">
';					
								$result = mysql_query("
									SELECT 
										Code, Name
									FROM material");
								
								$rows = array();
								while($row = mysql_fetch_array($result)){
								   echo '<option value="'.$row['Code'].'">'.$row['Code'].' - '.$row['Name'].'</option>';  
								}
echo '
					</datalist>	
	
		</td></th></tr>
		<tr><th style="width: 40px;"><label for="MatName">Название</label><td><input type="text" value=""   id="MatName" disabled="disabled" style="width: 70%; float: left;"></td></th></tr>
		<tr><th style="width: 40px;"><label for="Qty">Количество</label><td><input type="text" value="0"  class="integer" id="Qty"  onkeyup="calc()" style="float: left;"></td></th></tr>
		<tr><th style="width: 40px;"><label for="Price1">Цена</label><td><input type="text" value="0"   id="Price1" disabled="disabled" style="float: left;"></td></th></tr>
		<tr><th style="width: 40px;"><label for="Summ">Сумма</label><td><input type="text" value="0"   id="Summ" disabled="disabled" style="float: left;"></td></th></tr>
		<tr><th style="width: 40px;"><label for="Ball">Балл</label><td><input type="text" value="0"   id="Ball" disabled="disabled" style="float: left;"></td></th></tr>
		<tr><th style="width: 40px;"><label for="Balls">Баллы</label><td><input type="text" value="0"   id="Balls" disabled="disabled" style="float: left;"></td></th></tr>

    </table>
    <hr>
	<div id="orderline" height=100% style="margin: 0px; padding: 0px;"></div>
	
	<div id="result"><div>
	
	<input id="button" type="Button"  value="Отмена" title="Отмена" onclick="getPage('."'".'/core/Order/OrderUpdate.php?id='. $_GET['OrderID'].	''."'".')">            

	<input id="button" type="Button" value="Сохранить" title="Сохранить введенные данные" onclick="Request('."'".'OrderLine'."'".', '."'".'create'."'".', '	.$_GET['OrderID'].	')" >

</form>

<script>

	$(".numeric").numeric();
	$(".integer").numeric(false, function() { 
		this.value = "0"; 
		this.focus(); 
	});

</script>
';
